<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.yaodian100.core.common.utils.ServerValue" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ include file="/taglibs.jsp" %>

<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>' />

<script language="javascript">
	$().ready(function(){
		$("#printBtn").click(function(){
			window.print();
		});
		
		$("#exportBtn").click(function(){
			window.location.href="${midContextPath}/giftcard/exportReceiveItems.do?receiveId=${receiveId}";
		});
	});
</script>

<h1>礼品卡管理 - 领用检示</h1>

<s:if test="hasActionErrors()">
	<s:actionerror cssClass="msg rn"/><p />
</s:if>
<s:if test="hasActionMessages()">
	<s:actionmessage cssClass="msg rn"/><p />
</s:if>
<s:if test="hasFieldErrors()">
	<s:fielderror cssClass="msg rn"/><p />
</s:if>

<div class="f-link">
	<a href="${midContextPath}/giftcard/receiveList.do">返回礼品卡领用管理查询</a>
</div>
<br />
<br />
&nbsp;
<table class="tb-data" width="100%">
	<tr>
		<th width="25%">申请人</th>
		<td>
			${giftcardReceiveMain.applyUser}
		</td>
	</tr>
	<tr>
		<th>领用人</th>
		<td>
			${giftcardReceiveMain.receiveUser}
		</td>
	</tr>
	<tr>
		<th>状态</th>
		<td>
			${giftcardReceiveQueryStatusMenu.options[giftcardReceiveMain.status].name}
		</td>
	</tr>
	<tr>
		<th>核可处理人员</th>
		<td>
			${giftcardReceiveMain.approveUser}
		</td>
	</tr>
	<tr>
		<th>核可日期</th>
		<td>
			<fmt:formatDate value="${giftcardReceiveMain.approveDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>申请日期</th>
		<td>
			<fmt:formatDate value="${giftcardReceiveMain.applyDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>出库日期</th>
		<td>
			<fmt:formatDate value="${giftcardReceiveMain.receiveDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>建立人</th>
		<td>
			${giftcardReceiveMain.createUser}
		</td>
	</tr>
	<tr>
		<th>建立时间</th>
		<td>
			<fmt:formatDate value="${giftcardReceiveMain.createDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>修改人</th>
		<td>
			${giftcardReceiveMain.modifyUser}
		</td>
	</tr>
	<tr>
		<th>修改时间</th>
		<td>
			<fmt:formatDate value="${giftcardReceiveMain.modifyDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>不核可原因</th>
		<td>
			${giftcardReceiveMain.disapproveReason}
		</td>
	</tr>
</table>

<div class="f-link">
	<input type="button" name="printBtn" id="printBtn" value="打印" />
	<input type="button" name="exportBtn" id="exportBtn" value="汇出明细" />
</div>
<br /><br /><br />

<c-rt:set var="receiveTotalCount" value='0' />
<c-rt:set var="receiveTotalAmount" value='0' />
<table width="100%">
	<thead class="tb-1">
		<tr>
			<th>面额</th>
			<th>张数</th>
			<th>小计</th>
		</tr>
	</thead>
	<tbody class="tb-1">
		<c:forEach items="${giftcardReceiveItems}" var="giftcardReceiveItem" varStatus="rows_index">
			<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
				<td>${giftcardReceiveItem.amount}</td>
				<td>${giftcardReceiveItem.count}</td>
				<c-rt:set var="receiveTotalCount" value='${receiveTotalCount+giftcardReceiveItem.count}' />
				<td>${giftcardReceiveItem.amount*giftcardReceiveItem.count}</td>
				<c-rt:set var="receiveTotalAmount" value='${receiveTotalAmount+(giftcardReceiveItem.amount*giftcardReceiveItem.count)}' />
			</tr>
		</c:forEach>
	</tbody>
	<tr>
		<td colspan="2">
			总计张数：${receiveTotalCount}
		</td>
		<td colspan="2">
			总计金额：${receiveTotalAmount}
		</td>
	</tr>
</table>